package com.ideal.frame.template.controller;

import com.ideal.frame.common.dto.ResponseModel;
import com.ideal.frame.template.entity.AnalysisTemplate;
import com.ideal.frame.template.form.AnalysisTemplateForm;
import com.ideal.frame.template.service.AnalysisTemplateService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author ybb
 * @Description
 * @Date 2021/9/7 17:03
 */
@RestController
@RequestMapping("/analysis/template")
@Api("标识模板管理")
public class AnalysisTemplateController {

    @Autowired
    AnalysisTemplateService analysisTemplateService;

    @PostMapping("/pages")
    public ResponseModel pages(@RequestBody AnalysisTemplateForm searchForm){
        return ResponseModel.success(analysisTemplateService.pages(searchForm));
    }

    @GetMapping("/getOne/{id}")
    public ResponseModel getById(@PathVariable long id){
        return ResponseModel.success(analysisTemplateService.getOne(id));
    }

    @PostMapping("/add")
    public ResponseModel add(@RequestBody AnalysisTemplate analysisTemplate){
        analysisTemplateService.add(analysisTemplate);
        return ResponseModel.success();
    }

    @DeleteMapping("/del")
    public ResponseModel del(@RequestBody List<Long> ids){
        analysisTemplateService.del(ids);
        return ResponseModel.success();
    }
}
